/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.sql.SQLException;
/*    */ import java.util.List;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class ListAppCustomerPhone extends AbstractAction
/*    */ {
/* 27 */   private static Logger logger = Logger.getLogger(ListAppCustomerPhone.class
/* 28 */     .getName());
/*    */ 
/*    */   public ListAppCustomerPhone(AbstractHttpServlet servlet)
/*    */   {
/* 31 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 38 */     response.setContentType("text/html;charset=utf-8");
/* 39 */     PrintWriter out = response.getWriter();
/* 40 */     JSONObject jsonObject = new JSONObject();
/*    */ 
/* 42 */     CustomerManager manager = new CustomerManager();
/* 43 */     int id = Util.getURLIntParameter(request.getParameter("customerId"));
/* 44 */     int type = Util.getURLIntParameter(request.getParameter("type"));
/*    */     try
/*    */     {
/*    */       List phones;
///*    */       List phones;
/* 48 */       if (type == 0)
/* 49 */         phones = manager.getCompanyPhones(id);
/*    */       else {
/* 51 */         phones = manager.getPeoplePhones(id);
/*    */       }
/* 53 */       jsonObject.put("error", "0");
/* 54 */       jsonObject.put("phones", phones);
/*    */     } catch (SQLException e) {
/* 56 */       logger.warn("get customer's phone failed", e);
/* 57 */       jsonObject.put("error", "1");
/* 58 */       jsonObject.put("msg", "获得客户联系电话失败");
/*    */     }
/* 60 */     out.println(jsonObject);
/* 61 */     out.flush();
/* 62 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ListAppCustomerPhone
 * JD-Core Version:    0.6.1
 */